﻿@*
    TicketDesk - Attribution notice
    Contributor(s):

         Stephen Redd (stephen@reddnet.net, http://www.reddnet.net)

    This file is distributed under the terms of the Microsoft Public
    License (Ms-PL). See http://opensource.org/licenses/MS-PL
    for the complete terms of use.

    For any distribution that contains code from this file, this notice of
    attribution must remain intact, and a copy of the license must be
    provided to the recipient.
*@

@using TicketDesk.Domain.Model
@using System.Text.RegularExpressions
@using TicketDesk.Domain
@model TicketDesk.Web.Client.Models.TicketEmail
Content-Type: text/plain; charset=utf-8

----------------------------------------------------------------
Ticket #@Model.Ticket.TicketId - @(string.IsNullOrEmpty(Model.Ticket.Priority)? string.Empty: Model.Ticket.Priority + " Priority") @Model.Ticket.Category @Model.Ticket.TicketType
    @Model.Ticket.Title
----------------------------------------------------------------
@if (Model.IsMultiProject)
{
@:Project: @Model.Ticket.Project.ProjectName
}
Status: @Model.Ticket.TicketStatus.GetDescription()
Assigned To: @Model.Ticket.GetAssignedToInfo().DisplayName
Owner: @Model.Ticket.GetOwnerInfo().DisplayName
Updated by: @Model.Ticket.GetLastUpdatedByInfo().DisplayName at @Model.Ticket.LastUpdateDate.DateTime.ToShortDateString() @Model.Ticket.LastUpdateDate.DateTime.ToShortTimeString()
Details:
@{
        var details = Regex.Replace(Model.Ticket.HtmlDetails().ToString(), @"<(.|\n)*?>", "");
        if (details.Length > 100)
        {
            details = new string(details.Take(100).ToArray()) + "\n\n...";
        }
}

@details
----------------------------------------------------------------
Activity:
----------------------------------------------------------------

@foreach (var evt in Model.Ticket.TicketEvents.OrderByDescending(c => c.EventDate))
{
    var cmt = Regex.Replace(evt.HtmlComment().ToString(), @"<(.|\n)*?>", "");

@:    @evt.GetEventByInfo().DisplayName @evt.EventDescription
@:        @evt.EventDate.Date.ToLongDateString() @evt.EventDate.Date.ToShortTimeString()

@:    @cmt
@:----------------------------------------------------------------

}